clear

***********************************************
*Read-in panel data
use "./data/fomc_panel_b", clear

* Drop US
keep if ccode != 49 

foreach k in yield2y yield10y {

	*Standardize dependent variables country-by-country*
	bysort ccode: egen `k'_2day_sd = sd(`k'_2day)
	
	replace `k'_2day = `k'_2day / `k'_2day_sd

}


***ADVANCED COUNTRIES***
preserve 

keep if advanced==1

sort ccode date

drop time
egen time = group(date)
	
quietly: levelsof time , local(levels) 

sum time

foreach k in yield2y yield10y  {
	
	foreach i in `levels' { 
		
		***POOLED SAMPLE***
		* Advanced Full Sample
		quietly: reghdfe `k'_2day mps_2day mpu_2day if time!=`i', noabsorb cluster(ccode time)
		estimates store `k'_`i'	
			
	}
		
	coefplot (`k'_1) ///			
		(`k'_2) ///
		(`k'_3) ///
		(`k'_4) ///
		(`k'_5) ///
		(`k'_6) ///
		(`k'_7) ///
		(`k'_8) ///
		(`k'_9) ///
		(`k'_10) ///
		(`k'_11) ///
		(`k'_12) ///
		(`k'_13) ///
		(`k'_14) ///
		(`k'_15) ///
		(`k'_16) ///
		(`k'_17) ///
		(`k'_18) ///
		(`k'_19) ///
		(`k'_20) ///
		(`k'_21) ///
		(`k'_22) ///
		(`k'_23) ///
		(`k'_24) ///
		(`k'_25) ///
		(`k'_26) ///
		(`k'_27) ///
		(`k'_28) ///
		(`k'_29) ///
		(`k'_30) ///
		(`k'_31) ///
		(`k'_32) ///
		(`k'_33) ///
		(`k'_34) ///
		(`k'_35) ///
		(`k'_36) ///
		(`k'_37) ///
		(`k'_38) ///
		(`k'_39) ///
		(`k'_40) ///
		(`k'_41) ///
		(`k'_42) ///
		(`k'_43) ///
		(`k'_44) ///
		(`k'_45) ///
		(`k'_46) ///
		(`k'_47) ///
		(`k'_48) ///
		(`k'_49) ///
		(`k'_50) ///
		(`k'_51) ///
		(`k'_52) ///
		(`k'_53) ///
		(`k'_54) ///
		(`k'_55) ///
		(`k'_56) ///
		(`k'_57) ///
		(`k'_58) ///
		(`k'_59) ///
		(`k'_60) ///
		(`k'_61) ///
		(`k'_62) ///
		(`k'_63) ///
		(`k'_64) ///
		(`k'_65) ///
		(`k'_66) ///
		(`k'_67) ///
		(`k'_68) ///
		(`k'_69) ///
		(`k'_70) ///
		(`k'_71) ///
		(`k'_72) ///
		(`k'_73) ///
		(`k'_74) ///
		(`k'_75) ///
		(`k'_76) ///
		(`k'_77) ///
		(`k'_78) ///
		(`k'_79) ///
		(`k'_80) ///
		(`k'_81) ///
		(`k'_82) ///
		(`k'_83) ///
		(`k'_84) ///
		(`k'_85) ///
		(`k'_86) ///
		(`k'_87) ///
		(`k'_88) ///
		(`k'_89) ///
		(`k'_90) ///
		(`k'_91) ///
		(`k'_92) ///
		(`k'_93) ///
		(`k'_94) ///
		(`k'_95) ///
		(`k'_96) ///
		(`k'_97) ///
		(`k'_98) ///
		(`k'_99) ///
		(`k'_100) ///
		(`k'_101) ///
		(`k'_102) ///
		(`k'_103) ///
		(`k'_104) ///
		(`k'_105) ///
		(`k'_106) ///
		(`k'_107) ///
		(`k'_108) ///
		(`k'_109) ///
		(`k'_110) ///
		(`k'_111) ///
		(`k'_112) ///
		(`k'_113) ///
		(`k'_114) ///
		(`k'_115) ///
		(`k'_116) ///
		(`k'_117) ///
		(`k'_118) ///
		(`k'_119) ///
		(`k'_120) ///
		(`k'_121) ///
		(`k'_122) ///
		(`k'_123) ///
		(`k'_124) ///
		(`k'_125) ///
		(`k'_126) ///
		(`k'_127) ///
		(`k'_128) ///
		(`k'_129) ///
		(`k'_130) ///
		(`k'_131) ///
		(`k'_132) ///
		(`k'_133) ///
		(`k'_134) ///
		(`k'_135) ///
		(`k'_136) ///
		(`k'_137) ///
		(`k'_138) ///
		(`k'_139) ///
		(`k'_140) ///
		(`k'_141) ///
		(`k'_142) ///
		(`k'_143) ///
		(`k'_144) ///
		(`k'_145) ///
		(`k'_146) ///
		(`k'_147) ///
		(`k'_148) ///
		(`k'_149) ///
		(`k'_150) ///
		(`k'_151) ///
		(`k'_152) ///
		(`k'_153) ///
		(`k'_154) ///
		(`k'_155) ///
		(`k'_156) ///
		(`k'_157) ///
		(`k'_158) ///
		(`k'_159) ///
		(`k'_160) ///
		(`k'_161) ///
		(`k'_162) ///
		(`k'_163) ///
		(`k'_164) ///
		(`k'_165) ///
		(`k'_166) ///
		(`k'_167) ///
		(`k'_168) ///
		(`k'_169) ///
		(`k'_170) ///
		(`k'_171) ///
		(`k'_172) ///
		(`k'_173) ///
		(`k'_174) ///
		(`k'_175) ///
		(`k'_176) ///
		(`k'_177) ///
		(`k'_178) ///
		(`k'_179) ///
		(`k'_180) ///
		(`k'_181) ///
		(`k'_182) ///
		(`k'_183) ///
		(`k'_184) ///
		(`k'_185) ///
		(`k'_186) ///
		(`k'_187) ///
		(`k'_188) ///
		(`k'_189) ///
		(`k'_190) ///
		(`k'_191) ///
		(`k'_192) ///
		(`k'_193) ///
		(`k'_194) ///
		(`k'_195) ///
		(`k'_196) ///
		(`k'_197) ///
		(`k'_198) ///
		(`k'_199) ///
		(`k'_200) ///
		(`k'_201) ///
		(`k'_202) ///
		(`k'_203) ///
		(`k'_204) ///
			,keep(mpu_2day) mcolor(white) mlcolor(black) coeflabels(mpu_2day = " ") ///
		 ciopts(recast(rcap) lcolor(black)) levels(90) legend(off) msymbol(circle)

		graph export "tables\figureA8_`k'_advanced.pdf", replace	
		
	clear matrix
			
}

restore


***EME***
preserve 

keep if advanced==0

sort ccode date

drop time
egen time = group(date)
	
quietly: levelsof time , local(levels) 

sum time

foreach k in yield2y yield10y  {
	
	foreach i in `levels' { 
		
		* EME Full Sample
		quietly: reghdfe `k'_2day mps_2day mpu_2day if time!=`i', noabsorb cluster(ccode time)
		estimates store `k'_`i'	
			
	}
	
	coefplot (`k'_1) ///			
		(`k'_2) ///
		(`k'_3) ///
		(`k'_4) ///
		(`k'_5) ///
		(`k'_6) ///
		(`k'_7) ///
		(`k'_8) ///
		(`k'_9) ///
		(`k'_10) ///
		(`k'_11) ///
		(`k'_12) ///
		(`k'_13) ///
		(`k'_14) ///
		(`k'_15) ///
		(`k'_16) ///
		(`k'_17) ///
		(`k'_18) ///
		(`k'_19) ///
		(`k'_20) ///
		(`k'_21) ///
		(`k'_22) ///
		(`k'_23) ///
		(`k'_24) ///
		(`k'_25) ///
		(`k'_26) ///
		(`k'_27) ///
		(`k'_28) ///
		(`k'_29) ///
		(`k'_30) ///
		(`k'_31) ///
		(`k'_32) ///
		(`k'_33) ///
		(`k'_34) ///
		(`k'_35) ///
		(`k'_36) ///
		(`k'_37) ///
		(`k'_38) ///
		(`k'_39) ///
		(`k'_40) ///
		(`k'_41) ///
		(`k'_42) ///
		(`k'_43) ///
		(`k'_44) ///
		(`k'_45) ///
		(`k'_46) ///
		(`k'_47) ///
		(`k'_48) ///
		(`k'_49) ///
		(`k'_50) ///
		(`k'_51) ///
		(`k'_52) ///
		(`k'_53) ///
		(`k'_54) ///
		(`k'_55) ///
		(`k'_56) ///
		(`k'_57) ///
		(`k'_58) ///
		(`k'_59) ///
		(`k'_60) ///
		(`k'_61) ///
		(`k'_62) ///
		(`k'_63) ///
		(`k'_64) ///
		(`k'_65) ///
		(`k'_66) ///
		(`k'_67) ///
		(`k'_68) ///
		(`k'_69) ///
		(`k'_70) ///
		(`k'_71) ///
		(`k'_72) ///
		(`k'_73) ///
		(`k'_74) ///
		(`k'_75) ///
		(`k'_76) ///
		(`k'_77) ///
		(`k'_78) ///
		(`k'_79) ///
		(`k'_80) ///
		(`k'_81) ///
		(`k'_82) ///
		(`k'_83) ///
		(`k'_84) ///
		(`k'_85) ///
		(`k'_86) ///
		(`k'_87) ///
		(`k'_88) ///
		(`k'_89) ///
		(`k'_90) ///
		(`k'_91) ///
		(`k'_92) ///
		(`k'_93) ///
		(`k'_94) ///
		(`k'_95) ///
		(`k'_96) ///
		(`k'_97) ///
		(`k'_98) ///
		(`k'_99) ///
		(`k'_100) ///
		(`k'_101) ///
		(`k'_102) ///
		(`k'_103) ///
		(`k'_104) ///
		(`k'_105) ///
		(`k'_106) ///
		(`k'_107) ///
		(`k'_108) ///
		(`k'_109) ///
		(`k'_110) ///
		(`k'_111) ///
		(`k'_112) ///
		(`k'_113) ///
		(`k'_114) ///
		(`k'_115) ///
		(`k'_116) ///
		(`k'_117) ///
		(`k'_118) ///
		(`k'_119) ///
		(`k'_120) ///
		(`k'_121) ///
		(`k'_122) ///
		(`k'_123) ///
		(`k'_124) ///
		(`k'_125) ///
		(`k'_126) ///
		(`k'_127) ///
		(`k'_128) ///
		(`k'_129) ///
		(`k'_130) ///
		(`k'_131) ///
		(`k'_132) ///
		(`k'_133) ///
		(`k'_134) ///
		(`k'_135) ///
		(`k'_136) ///
		(`k'_137) ///
		(`k'_138) ///
		(`k'_139) ///
		(`k'_140) ///
		(`k'_141) ///
		(`k'_142) ///
		(`k'_143) ///
		(`k'_144) ///
		(`k'_145) ///
		(`k'_146) ///
		(`k'_147) ///
		(`k'_148) ///
		(`k'_149) ///
		(`k'_150) ///
		(`k'_151) ///
		(`k'_152) ///
		(`k'_153) ///
		(`k'_154) ///
		(`k'_155) ///
		(`k'_156) ///
		(`k'_157) ///
		(`k'_158) ///
		(`k'_159) ///
		(`k'_160) ///
		(`k'_161) ///
		(`k'_162) ///
		(`k'_163) ///
		(`k'_164) ///
		(`k'_165) ///
		(`k'_166) ///
		(`k'_167) ///
		(`k'_168) ///
		(`k'_169) ///
		(`k'_170) ///
		(`k'_171) ///
		(`k'_172) ///
		(`k'_173) ///
		(`k'_174) ///
		(`k'_175) ///
		(`k'_176) ///
		(`k'_177) ///
		(`k'_178) ///
		(`k'_179) ///
		(`k'_180) ///
		(`k'_181) ///
		(`k'_182) ///
		(`k'_183) ///
		(`k'_184) ///
		(`k'_185) ///
		(`k'_186) ///
		(`k'_187) ///
		(`k'_188) ///
		(`k'_189) ///
		(`k'_190) ///
		(`k'_191) ///
		(`k'_192) ///
		(`k'_193) ///
		(`k'_194) ///
		(`k'_195) ///
		(`k'_196) ///
		(`k'_197) ///
		(`k'_198) ///
		(`k'_199) ///
		(`k'_200) ///
		(`k'_201) ///
		(`k'_202) ///
		(`k'_203) ///
		(`k'_204) ///
			,keep(mpu_2day) mcolor(white) mlcolor(black) coeflabels(mpu_2day = " ") ///
		 ciopts(recast(rcap) lcolor(black)) levels(90) legend(off) msymbol(circle)

		graph export "tables\figureA8_`k'_eme.pdf", replace	
		
	clear matrix
			
}

restore
